package com.foreveross.proxyip.core.pools.validate;

import com.foreveross.proxyip.core.BaseCode;
import com.foreveross.proxyip.core.redis.PiRedisExecption;
import com.foreveross.proxyip.infra.conf.PropertyUtils;
import com.foreveross.proxyip.infra.conf.proxyip.ProxyIpPropertiesLoader;
import com.foreveross.proxyip.util.Config;

public class DbTestProxyIp extends TestProxyIp {

	public DbTestProxyIp(String poolSign) throws NumberFormatException, PiRedisExecption {
		super(poolSign);
		setConfig();
		// TODO Auto-generated constructor stub
	}

	@Override
	public void setConfig() throws NumberFormatException, PiRedisExecption {
		Integer channelConnectTimeout = Integer.parseInt( BaseCode.getValue("DB_CONNECT_TIMEOUT"));
		
		Integer channelSoTimeout = Integer.parseInt( BaseCode.getValue("DB_SO_TIMEOUT")); 
		
//		Integer channelMaxUsedCount = Integer.parseInt( PropertyUtils.getProperty(
//				Config.DB_MAX_USED_COUNT
//				, ProxyIpPropertiesLoader.CONFIG_FILE)); 
		
//		Integer valiSeparTime = Integer.parseInt( PropertyUtils.getProperty(
//				Config.DB_IP_VALI_SEPAR_TIME
//				, ProxyIpPropertiesLoader.CONFIG_FILE)); 
		
//		Long ipAvailTime = Long.parseLong( PropertyUtils.getProperty(
//				Config.DB_IP_AVAIL_TIME
//				, ProxyIpPropertiesLoader.CONFIG_FILE)); 
		
		Integer proxyValiType = Integer.parseInt( BaseCode.getValue("DB_PROXY_VALI_TYPE")); 
		
		super.connectTimeout = channelConnectTimeout;
		super.soTimeout= channelSoTimeout;
//		super.maxUsedCount = channelMaxUsedCount;
//		super.valiSeparTime = valiSeparTime;
//		super.ipAvailTime = ipAvailTime;
		super.proxyValiType = proxyValiType;
		String speedGradesStr = BaseCode.getValue("SPEED_GRADE");
		this.setSpeedGrades(speedGradesStr);

	}

	@Override
	public boolean isValidate() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public String getConnectUrl() {
		return null;
	}

}
